using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace DataWinner.Entity.Nba_Sina.Models.Mapping
{
    public class TeamStatDaily_SinaMap : EntityTypeConfiguration<TeamStatDaily_Sina>
    {
        public TeamStatDaily_SinaMap()
        {
            // Primary Key
            this.HasKey(t => t.TeamSataDailyId);

            // Properties
            this.Property(t => t.Id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            this.Property(t => t.TeamSataDailyId)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.TeamId)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.TeamStatId)
                .IsRequired()
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("TeamStatDaily_Sina");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.TeamSataDailyId).HasColumnName("TeamSataDailyId");
            this.Property(t => t.TeamId).HasColumnName("TeamId");
            this.Property(t => t.TeamStatId).HasColumnName("TeamStatId");
            this.Property(t => t.StatType).HasColumnName("StatType");
            this.Property(t => t.MatchDate).HasColumnName("MatchDate");
            this.Property(t => t.CreateBy).HasColumnName("CreateBy");
            this.Property(t => t.CreateTime).HasColumnName("CreateTime");
            this.Property(t => t.ModifyBy).HasColumnName("ModifyBy");
            this.Property(t => t.ModifyTime).HasColumnName("ModifyTime");
            this.Property(t => t.IsDeleted).HasColumnName("IsDeleted");

            // Relationships
            this.HasRequired(t => t.Team_Sina)
                .WithMany(t => t.TeamStatDaily_Sina)
                .HasForeignKey(d => d.TeamId);
            this.HasRequired(t => t.TeamStat_Sina)
                .WithMany(t => t.TeamStatDaily_Sina)
                .HasForeignKey(d => d.TeamStatId);

        }
    }
}
